<template>
{{#if page.psSysPFPlugin}}
  {{> @macro/plugins/view/view-use.hbs appPlugin=page.psSysPFPlugin}}
{{else}}
  {{#if page.psViewLayoutPanel.useDefaultLayout}}
	<AppMDViewLayout :class="classNames" :openType="openType">
		<template #viewHeaderContentLeft v-if="!noViewCaption && model.showCaption">
			<div class="view-header__caption">
				{{> @macro/view/view-caption.hbs}}
				{{> @macro/view/view-datainfo-bar.hbs}}
			</div>
        </template>
		{{#hasCtrl page.ctrls 'TOOLBAR'}}
		<template #viewHeaderContentRight  {{#if (hasCtrl page.ctrls 'TOOLBAR')}}v-if="store.toolbarItems.length >0"{{/if}}>
			{{#each page.ctrls as | ctrl |}}
				{{#eq ctrl.controlType 'TOOLBAR'}}
			<div class="view-header__toolbar">
				{{> @macro/widgets/toolbar/toolbar.hbs page=page ctrl=ctrl}}
			</div>
				{{/eq}}
			{{/each}}
		</template>
		{{/hasCtrl}}
        <template #default>
        {{#each page.ctrls as | ctrl |}}
        {{#eq ctrl.controlType 'MULTIEDITVIEWPANEL'}}
            {{> @macro/widgets/multi-editview-panel/multi-editview-panel.hbs ctrl=ctrl}}
        {{/eq}}
        {{/each}}
		</template>
		{{> @macro/view/view-msg.hbs}}  
	</AppMDViewLayout>
  {{else}}
    <div :class="classNames">
		{{#if page.psViewLayoutPanel.rootPSPanelItems}}
			{{#each page.psViewLayoutPanel.rootPSPanelItems as | panelItem |}}
		{{> @macro/widgets/panel-detail/include-panel.hbs type=panelItem.itemType item=panelItem isMultiData=false panel=page.psViewLayoutPanel page=page}}
			{{/each}}
		{{/if}}
	</div> 
	{{/if}}
{{/if}}
</template>
<script lang="ts" setup>
// 基于template/src/views/\{{appModules}}/\{{pages@DEMEDITVIEW9}}/\{{spinalCase page.codeName}}.vue.hbs生成
{{#if page.psViewLayoutPanel.useDefaultLayout}}
import { AppMDViewLayout } from '@components/layout/md-view-layout';
{{> @macro/widgets/ctrl/import-ctrl.hbs ctrls=page.ctrls}}
{{else}}
import { AppCtrlPos, AppScrollContainer, AppSimpleFlexContainer, AppStandardContainer, AppTabPanel, AppTabPage } from '@components/layout-element/structure';
	{{#if page.psViewLayoutPanel.viewProxyMode}}
{{> @macro/widgets/ctrl/import-ctrl.hbs ctrls=page.psViewLayoutPanel.psControls}}
	{{else}}
{{> @macro/widgets/ctrl/import-ctrl.hbs ctrls=page.ctrls}}
	{{/if}}
{{/if}}
import { 
	useNavParamsBind,
	useEventBind,
{{#hasCtrl page.ctrls 'TOOLBAR'}}
  handleToolbarItemClick,
{{/hasCtrl}}
	handleCtrlAction,
	handleCtrlInit,
	handleCtrlDestroy,
	getViewClassNames,
{{#unless page.psViewLayoutPanel.useDefaultLayout}}
  handleComponentAction,
{{/unless}}
} from "@/hooks/use-view";
import {
	MEditViewActionType,
	IContext,
	IParam,
	IMEditViewAbility,
	IMEditViewControllerParams,
	IMEditViewStore,
	MEditViewController,
	IMEditViewController,
	ILoadingHelper,
	IEvent
} from '@/core';
import { model } from "./{{spinalCase page.codeName}}-model";

{{> @macro/view/view-props.hbs}}

{{> @macro/common/emit.hbs name="view" actionType="MEditViewActionType" ability="IMEditViewAbility"}}

const classNames = computed(() => {
    return getViewClassNames(model, props);
});

const params: IMEditViewControllerParams<MEditViewActionType, IMEditViewAbility> = { 
	name: props.name,
	model, 
	evt, 
	isLoadDefault: props.isLoadDefault,
	openType: props.openType, 
	pLoadingHelper: props.pLoadingHelper, 
	handler: (data: IMEditViewStore) => { return reactive(data); } 
};

{{> @macro/common/controller.hbs name="view" IController="IMEditViewController" store="IMEditViewStore" ability="IMEditViewAbility" controller="MEditViewController"}}
</script>
